<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>从二进制字符串里读取图片</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="imagick.readimage.html">« Imagick::readImage</a></li>
      <li style="float: right;"><a href="imagick.readimagefile.html">Imagick::readImageFile »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.imagick.html">Imagick</a></li>
    <li>从二进制字符串里读取图片</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="imagick.readimageblob" class="refentry">
    <div class="refnamediv">
        <h1 class="refname">Imagick::readImageBlob</h1>
        <p class="verinfo">(PECL imagick 2, PECL imagick 3)</p><p class="refpurpose"><span class="refname">Imagick::readImageBlob</span> &mdash; <span class="dc-title">从二进制字符串里读取图片</span></p>

    </div>

    <div class="refsect1 description" id="refsect1-imagick.readimageblob-description">
        <h3 class="title">说明</h3>
        <div class="methodsynopsis dc-description">
            <span class="modifier">public</span> <span class="methodname"><strong>Imagick::readImageBlob</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$image</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code><span class="initializer"> = ?</span></span>): <span class="type">bool</span></div>

        <p class="para rdfs-comment">
            从二进制字符串里读取图片
        </p>
    </div>


    <div class="refsect1 parameters" id="refsect1-imagick.readimageblob-parameters">
        <h3 class="title">参数</h3>
        <p class="para">
            <dl>
                
                    <dt>
<code class="parameter">image</code></dt>

                    <dd>

                        <p class="para">
                        </p>
                    </dd>

                
            </dl>

        </p>
    </div>


    <div class="refsect1 returnvalues" id="refsect1-imagick.readimageblob-returnvalues">
        <h3 class="title">返回值</h3>
        <p class="para">
            成功时返回 <strong><code>true</code></strong>。
        </p>
    </div>


    <div class="refsect1 errors" id="refsect1-imagick.readimageblob-errors">
        <h3 class="title">错误／异常</h3>
        <p class="para">
            错误时抛出 ImagickException。
        </p>
    </div>




    <div class="refsect1 examples" id="refsect1-imagick.readimageblob-examples">
        <h3 class="title">范例</h3>
        <p class="para">
            <div class="example" id="example-2842">
                <p><strong>示例 #1  <span class="function"><strong>Imagick::readImageBlob()</strong></span></strong></p>
                <div class="example-contents">
                    <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">readImageBlob</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$base64&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"iVBORw0KGgoAAAANSUhEUgAAAM0AAAD<br />&nbsp;NCAMAAAAsYgRbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5c<br />&nbsp;cllPAAAABJQTFRF3NSmzMewPxIG//ncJEJsldTou1jHgAAAARBJREFUeNrs2EEK<br />&nbsp;gCAQBVDLuv+V20dENbMY831wKz4Y/VHb/5RGQ0NDQ0NDQ0NDQ0NDQ0NDQ<br />&nbsp;0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0PzMWtyaGhoaGhoaGhoaGhoaGhoxtb0QGho<br />&nbsp;aGhoaGhoaGhoaGhoaMbRLEvv50VTQ9OTQ5OpyZ01GpM2g0bfmDQaL7S+ofFC6x<br />&nbsp;v3ZpxJiywakzbvd9r3RWPS9I2+MWk0+kbf0Hih9Y17U0nTHibrDDQ0NDQ0NDQ0<br />&nbsp;NDQ0NDQ0NTXbRSL/AK72o6GhoaGhoRlL8951vwsNDQ0NDQ1NDc0WyHtDTEhD<br />&nbsp;Q0NDQ0NTS5MdGhoaGhoaGhoaGhoaGhoaGhoaGhoaGposzSHAAErMwwQ2HwRQ<br />&nbsp;AAAAAElFTkSuQmCC"</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$imageBlob&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">base64_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$base64</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$imagick&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Imagick</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">readImageBlob</span><span style="color: #007700">(</span><span style="color: #0000BB">$imageBlob</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-Type:&nbsp;image/png"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$imagick</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
                </div>

            </div>
        </p>
    </div>


</div></div></div></body></html>